<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
   <meta name="GENERATOR" content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
   <meta name="Author" content="Phil Burk">
   <meta name="Description" content="Tutorial for PortAudio, a cross platform, open-source, audio I/O library.It provides a very simple API for recording and/or playing sound using a simple callback function.">
   <meta name="KeyWords" content="audio, tutorial, library, portable, open-source, DirectSound,sound, music, JSyn, synthesis,">
   <title>PortAudio Tutorial</title>
</head>
<body>
&nbsp;
<center><table COLS=1 WIDTH="100%" BGCOLOR="#FADA7A" >
<tr>
<td>
<center>
<h1>
PortAudio Tutorial</h1></center>
</td>
</tr>
</table></center>

<h2>
Overview of PortAudio</h2>

<blockquote>PortAudio is a library that provides streaming audio input
and output. It is a cross-platform API (Application Programming Interface)
that works on Windows, Macintosh, Unix running OSS, SGI, BeOS, and perhaps
other platforms by the time you read this. This means that you can write
a simple 'C' program to process or generate an audio signal, and that program
can run on several different types of computer just by recompiling the
source code.
<p>Here are the steps to writing a PortAudio application:
<ol>
<li>
Write a callback function that will be called by PortAudio when audio processing
is needed.</li>

<li>
Initialize the PA library and open a stream for audio I/O.</li>

<li>
Start the stream. Your callback function will be now be called repeatedly
by PA in the background.</li>

<li>
In your callback you can read audio data from the inputBuffer and/or write
data to the outputBuffer.</li>

<li>
Stop the stream by returning 1 from your callback, or by calling a stop
function.</li>

<li>
Close the stream and terminate the library.</li>
</ol>
</blockquote>

<blockquote>There is also <a href="pa_tut_rw.html">another interface</a>
provided that allows you to generate audio in the foreground. You then
simply write data to the stream and the tool will not return until it is
ready to accept more data. This interface is simpler to use but is usually
not preferred for large applications because it requires that you launch
a thread to perform the synthesis. Launching a thread may be difficult
on non-multi-tasking systems such as the Macintosh prior to MacOS X.
<p>Let's continue by building a simple application that will play a sawtooth
wave.
<p>Please select the page for the specific implementation you would like
to use:
<ul>
<li>
<a href="pa_tut_pc.html">Windows (WMME or DirectSound)</a></li>

<li>
<a href="pa_tut_mac.html">Macintosh SoundManager for OS 7,8,9</a></li>

<li>
<a href="pa_tut_mac_osx.html">Macintosh CoreAudio for OS X</a></li>

<li>
<a href="pa_tut_asio.html">ASIO on Windows or Macintosh</a></li>

<li>
<a href="pa_tut_oss.html">Unix OSS</a></li>
</ul>
or continue with the <a href="pa_tut_callback.html">next page of the programming
tutorial</a>.</blockquote>
<font size=+2><a href="http://www.portaudio.com/">home</a> |
<a href="pa_tutorial.html">contents</a>
| <a href="pa_tutorial.html">previous</a></font>
</body>
</html>
